# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1ResolvedPolicy do
  @moduledoc """
  The resolved value of a policy for a given target.

  ## Attributes

  *   `addedSourceKey` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t`, *default:* `nil`) - Output only. The added source key establishes at which level an entity was explicitly added for management. This is useful for certain type of policies that are only applied if they are explicitly added for management. For example: apps and networks. An entity can only be deleted from management in an Organizational Unit that it was explicitly added to. If this is not present it means that the policy is managed without the need to explicitly add an entity, for example: standard user or device policies.
  *   `sourceKey` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t`, *default:* `nil`) - Output only. The source resource from which this policy value is obtained. May be the same as `targetKey` if the policy is directly modified on the target, otherwise it would be another resource from which the policy gets its value (if applicable). If not present, the source is the default value for the customer.
  *   `targetKey` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t`, *default:* `nil`) - Output only. The target resource for which the resolved policy value applies.
  *   `value` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyValue.t`, *default:* `nil`) - Output only. The resolved value of the policy.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :addedSourceKey =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t() | nil,
          :sourceKey =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t() | nil,
          :targetKey =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey.t() | nil,
          :value =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyValue.t() | nil
        }

  field(:addedSourceKey,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey
  )

  field(:sourceKey,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey
  )

  field(:targetKey,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyTargetKey
  )

  field(:value, as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyValue)
end

defimpl Poison.Decoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1ResolvedPolicy do
  def decode(value, options) do
    GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1ResolvedPolicy.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1ResolvedPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
